﻿using System;
using System.Configuration;

namespace SSP.Api
{
    ///<summary>
    ///</summary>
    public sealed class AppSettings
    {
        static readonly AppSettings _instance = new AppSettings();
        private readonly string _apikey;
        private readonly string _path;
        private readonly int _columnCount;
        private readonly bool _useLocalCache;
        private readonly int _transitionPause;

        /// <summary>
        /// Gets the default.
        /// </summary>
        /// <value>The default.</value>
        public static AppSettings Default
        {
            get
            {
                return _instance;
            }
        }

        AppSettings()
        {
            _apikey = ConfigurationManager.AppSettings["ApiKey"];
            _path = ConfigurationManager.AppSettings["Path"];
            _columnCount = Convert.ToInt32( ConfigurationManager.AppSettings["ColumnCount"]);
            _useLocalCache = Convert.ToBoolean(ConfigurationManager.AppSettings["UseLocalCache"]);
            _transitionPause = Convert.ToInt32(ConfigurationManager.AppSettings["TransitionPause"]);
        }

        /// <summary>
        /// Gets the API key.
        /// </summary>
        /// <value>The API key.</value>
        public string ApiKey
        {
            get
            {
                return _apikey;
            }
        }

        /// <summary>
        /// Gets the path.
        /// </summary>
        /// <value>The path.</value>
        public string Path
        {
            get
            {
                return _path;
            }
        }

        /// <summary>
        /// Gets the column count.
        /// </summary>
        /// <value>The column count.</value>
        public int ColumnCount
        {
            get
            {
                return _columnCount;
            }
        }

        /// <summary>
        /// Gets a value indicating whether [use local cache].
        /// </summary>
        /// <value><c>true</c> if [use local cache]; otherwise, <c>false</c>.</value>
        public bool UseLocalCache
        {
            get
            {
                return _useLocalCache;
            }
        }

        /// <summary>
        /// Gets the transition pause.
        /// </summary>
        /// <value>The transition pause.</value>
        public int TransitionPause
        {
            get
            {
                return _transitionPause;
            }
        }

    }
}
